#!/bin/bash
predeploy_dir=/data/soft/deploypre

        echo "1) k9pf(online)"
        echo "2) k9pay(online)"
        echo "3) k9ope"
        echo "4) k9openpf(online)"
        echo "5) k9lg(online)"
        echo "6) k9analysis"
        echo "7) k9cs"
        echo "8) k9dev"
        echo "9) k9mail"
        echo "10) k9nba"
        echo "11) k9official"
        echo "12) k9game"
        echo "13) k9forum_us"
        echo "14) k9ope_inner"
        echo "15) project_1"
        echo "16) k9wiki"
	echo "17) monster"
	echo "18) k9forum_cn"
	echo "19) k9paycallback"
	echo "20) cnk9pay"
	echo "21) cnk9official"
read -p "choice deploy application :" app
        [ "x$app" == "x1" ] && app='k9pf'
        [ "x$app" == "x2" ] && app='k9pay'
        [ "x$app" == "x3" ] && app='k9ope'
        [ "x$app" == "x4" ] && app='k9openpf'
        [ "x$app" == "x5" ] && app='k9lg'
        [ "x$app" == "x6" ] && app='k9analysis'
        [ "x$app" == "x7" ] && app='k9cs'
        [ "x$app" == "x8" ] && app='k9developer'
        [ "x$app" == "x9" ] && app='k9mail'
        [ "x$app" == "x10" ] && app='k9nba'
        [ "x$app" == "x11" ] && app='k9official'
        [ "x$app" == "x12" ] && app='k9game'
        [ "x$app" == "x13" ] && app='k9forum_us'
        [ "x$app" == "x14" ] && app='k9ope_inner'
	[ "x$app" == "x15" ] && app='project_1'
	[ "x$app" == "x16" ] && app='k9wiki'
	[ "x$app" == "x17" ] && app='monster'
	[ "x$app" == "x18" ] && app='k9forum_cn'
	[ "x$app" == "x19" ] && app='k9paycallback'
	[ "x$app" == "x20" ] && app='cnk9pay'
	[ "x$app" == "x21" ] && app='cnk9official'
cd $predeploy_dir

branch_pre=''
tmppwd=$(pwd)
if [ $app == 'k9pay' -o $app == 'cnk9official' ]
then
        app='k9pay'
        branch_pre='cn_'
fi
if [ -d ./KICK9_MERGE/$app ]
then
        cd ./KICK9_MERGE/$app
        git checkout ${branch_pre}development
        git checkout ${branch_pre}release
        git checkout ${branch_pre}master
else
        echo app error
        echo 'support apps : cnk9pay; k9analysis; k9cs; k9dev; k9lg; k9nba; k9official; k9ope; k9openpf; k9pay; k9pf;'
fi
cd $tmppwd
echo at `date "+%F %T"` $app was merged and will be deloyed >> /data/soft/deploypre/merge.log
